#!/bin/bash

host_name=`hostname`

make_config(){
  /bin/cp -f /tmp/kafka/server.properties /etc/kafka-conf/
  sed -i 's/HOST_NAME/'${host_name}.${MY_POD_SERVICE}'/g' /etc/kafka-conf/server.properties
}


case "$1" in
  broker)
  make_config
  cd /opt/kafka
  bin/kafka-server-start.sh /etc/kafka-conf/server.properties
  ;;
  cmak)
  cd /opt/cmak
  bin/cmak -Dconfig.file=/etc/cmak-conf/application.conf -Dhttp.port=9000
  ;;
  bash)
  /bin/bash
  ;;
esac

#exec /usr/bin/tini -s -- "${CMD}"
